/*
 * @Author: Robin
 * @Date: 2021-07-14 14:29:43
 * @LastEditors: Robin
 * @LastEditTime: 2021-07-14 14:56:45
 * @Description: golang生成pdf文件
 */
package main

import (
	"fmt"

	"github.com/jung-kurt/gofpdf"
)

func main() {
	pdf := gofpdf.New("P", "mm", "A4", "")
	pdf.AddPage()
	pdf.AddUTF8Font("Chinese", "", "WenQuanDengKuanZhengHei-1.ttf")
	pdf.SetFont("Chinese", "", 12)
	pdf.Cell(40, 10, "Hello, world")
	pdf.Cell(40, 40, "这是中文测试")
	err := pdf.OutputFileAndClose("hello.pdf")
	if err != nil {
		fmt.Println(err)
	}
}
